﻿using System.Diagnostics;

namespace DimensionsHelper.LanguageService.Syntax;

public class MacroStringizer : SourceNode
{
    private readonly SourceNode _hashToken;
    private readonly SourceNode _nameIdentifier;

    internal MacroStringizer(SourceNode? parent, SourceNode hashToken, SourceNode name) :
        base(parent, SyntaxKinds.MacroStringizer)
    {
        SetChildField(ref _hashToken, hashToken);
        SetChildField(ref _nameIdentifier, name);
    }


    public SourceNode HashToken => _hashToken;

    public SourceNode NameIdentifier => _nameIdentifier;


    public override void AcceptVisitor<T>(SyntaxNodeVisitor<T> visitor)
    {
        Accept(visitor, HashToken, NameIdentifier);
    }
}


public static partial class NodeFactory
{
    public static MacroStringizer CreateMacroStringizer(SourceNode parent, SourceNode hashToken, SourceNode name)
    {
        Debug.Assert(hashToken.IsNode(SyntaxKinds.HashToken));
        Debug.Assert(name.IsIdentifier);
        return new MacroStringizer(parent, hashToken, name);
    }
}